<template>
  <view class="patrolInspect-detail-card">
    <view class="patrolInspect-detail-card-title">隐患详情</view>
    <view class="universal-detail-item">
      <view class="universal-detail-item-title">工程名称：</view>
      <view class="universal-detail-item-cont">{{ detail.projectName }}</view>
    </view>
    <view class="universal-detail-item">
      <view class="universal-detail-item-title">关联设备：</view>
      <view class="universal-detail-item-cont">
        <template v-if="detail.relatedEquipment">
          {{ detail.relatedEquipment?.map((it) => it.name).join('、') }}
        </template>
        <template v-else>-</template>
      </view>
    </view>
    <view class="universal-detail-item">
      <view class="universal-detail-item-title">发现时间：</view>
      <view class="universal-detail-item-cont">{{ detail.discoverTime }}</view>
    </view>
    <view class="universal-detail-item">
      <view class="universal-detail-item-title">隐患描述：</view>
      <view class="universal-detail-item-cont">{{ detail.desc }}</view>
    </view>
    <view class="universal-detail-item">
      <view class="universal-detail-item-title">维修前照片：</view>
      <view class="universal-detail-list">
        <image v-for="(image, index) in detail.imageBefore" :src="image.url" mode="aspectFit" @click="handleImagePreview(image.url, index)" class="universal-detail-list-image"></image>
      </view>
    </view>
    <view class="universal-detail-item">
      <view class="universal-detail-item-title">维修前视频：</view>
      <view class="universal-detail-list">
        <video-preview v-for="(image, index) in detail.videoBefore" :src="image.url"></video-preview>
      </view>
    </view>
    <view class="form-troble-title">立即处置：{{ detail.manager ? '否' : '是' }}</view>

    <!-- 指派人 -->
    <template v-if="detail.manager">
      <view class="universal-detail-item">
        <view class="universal-detail-item-title">接收人：</view>
        <view class="universal-detail-item-cont">{{ detail.managerName }}</view>
      </view>
    </template>
    <!-- 立即处置 -->
    <template v-else>
      <view class="universal-detail-item">
        <view class="universal-detail-item-title">处理结果：</view>
        <view class="universal-detail-item-cont">{{ detail.repairResult }}</view>
      </view>
      <view class="universal-detail-item">
        <view class="universal-detail-item-title">维修后照片：</view>
        <view class="universal-detail-list">
          <image v-for="(image, index) in detail.imageAfter" :src="image.url" mode="aspectFit" @click="handleImagePreview(image.url, index)" class="universal-detail-list-image"></image>
        </view>
      </view>
      <view class="universal-detail-item">
        <view class="universal-detail-item-title">维修后视频：</view>
        <view class="universal-detail-list">
          <video-preview v-for="(image, index) in detail.videoAfter" :src="image.url"></video-preview>
        </view>
      </view>
    </template>

  </view>
</template>

<script setup>
import { onBeforeUpdate } from 'vue';
const props = defineProps({
  detail: {},
  dealStatus: ''
});
</script>

<style lang="scss" scoped>
@import '@/assets/universal-detail.scss';
.patrolInspect-detail-card-title {
  padding-top: 10rpx;
  font-weight: bold;
  border-bottom: 1px solid #ccc;
}
</style>